package com.xuanyuan.test

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.chip.Chip
import com.xuanyuan.material.R
import com.zhy.view.flowlayout.FlowLayout
import com.zhy.view.flowlayout.TagAdapter

/**
 * Copyright (C), 2017-2022, Anker
 * FileName: GGG
 *
 * @author ken.luo
 * Date: 2022/6/29 20:12
 * Description:
 * History:
 * 创建者 : ken.luo
 * <author>     <time>     <version>      <desc>
 * 作者姓名      修改时间      版本号          描述
</desc></version></time></author> */
class TagSearchAdapter<String>(var mInflater: LayoutInflater, var isShowDelete:Boolean,var root: ViewGroup, datas: Array<String>) : TagAdapter<String>(datas) {


    var mdatas: Array<String>
    var mShowDelete:Boolean=false

    init {
        mdatas = datas
        mShowDelete = isShowDelete
    }

    override fun getView(parent: FlowLayout?, position: Int, t: String): View {
        val tv = mInflater.inflate(R.layout.item_main_button, root, false) as Chip
        tv.text = mdatas[position].toString()
        tv.isCloseIconVisible = isShowDelete
//        tv.isCloseIconVisible = true
        return tv
    }
}